﻿using System.Configuration.Provider;
using System.IdentityModel.Claims;

namespace Altairis.IdentityToolkit {
    /// <summary>
    /// Class that defines the contract that identity link providers implements to 
    /// provide identity linking services using custom identity link providers.
    /// </summary>
    public abstract class IdentityLinkProvider : ProviderBase  {
        
        /// <summary>
        /// When overriden in derived class, checks if given provider supports certain type of claims.
        /// </summary>
        /// <param name="claimSet">The claim set to be analyzed.</param>
        /// <returns><c>true</c> if provider supports given claim set; otherwise <c>false</c>.</returns>
        public abstract bool Supports(ClaimSet claimSet);

        /// <summary>
        /// When overriden in derived class, resolves the link between given claim set and user name.
        /// </summary>
        /// <param name="claimSet">The claim set.</param>
        /// <returns>membership user name linked to given claim set. Returns <c>null</c> when no link was found.</returns>
        public abstract string ResolveLink(ClaimSet claimSet);

        /// <summary>
        /// When overriden in derived class, creates the link between given claim set and user name.
        /// </summary>
        /// <param name="claimSet">The claim set.</param>
        /// <param name="userName">Membership user name.</param>
        public abstract void CreateLink(ClaimSet claimSet, string userName);

    }
}
